﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Data.SqlClient;
using BCDataCenter.DataAccessLayer;

/// <summary>
/// Summary description for BWMenuCatalogue
/// </summary>

namespace BCDataCenter.BOL
{
    public class BWMenuCatalogueUser
    {
        string SqlGetMenuCatalogue = "get_MenuCatalogue";
        string SqlGetUserAndType = "get_UserAndType";
        string SqlGetMenuCatalogueUser = "get_MenuCatalogue_User";
        string SqlInsertUserModule = "Insert_User_Module";

        public BWMenuCatalogueUser()
        {
            //
            // TODO: Add constructor logic here
            //
        }
        public DataSet dsMenuCatalogue(ref string error, string MenuID, string UserName)
        {
            return new DAL().MyExecuteQuery(ref error, SqlGetMenuCatalogue, CommandType.StoredProcedure, new SqlParameter("@MenuID", MenuID), new SqlParameter("@UserName", UserName));
        }
        public DataSet dsMenuCatalogueUser(ref string error, string MenuID, string UserName)
        {
            return new DAL().MyExecuteQuery(ref error, "get_MenuCatalogue_User", CommandType.StoredProcedure, new SqlParameter("@MenuID", MenuID), new SqlParameter("@UserName", UserName));
        }

        public System.Data.DataSet dsUserList(ref string error)
        {
            return new DAL().MyExecuteReader(ref error, SqlGetUserAndType, System.Data.CommandType.StoredProcedure);
        }

        public bool InsertUserModule(ref string error, DataTable dt)
        {
            string[] ParamName = new string[] { "@UserName", "@PageID", "@PageName", "@MenuID", "@count" };
            string[] ColumnName = new string[] { "UserName", "PageID", "PageName", "MenuID", "Count" };
            return new DAL().MyExecuteNonQueryWithTransaction(ref error, SqlInsertUserModule, CommandType.StoredProcedure, ParamName, dt, ColumnName);
        }
    }
}
